home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / vb-scr1a / notepad.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-09-10  |  13.3 KB  |  477 lines

  1. VERSION 2.00
  2. Begin Form frmNotePad 
  3.    Caption         =   "Untitled"
  4.    ClientHeight    =   3975
  5.    ClientLeft      =   600
  6.    ClientTop       =   2430
  7.    ClientWidth     =   5610
  8.    Height          =   4665
  9.    Left            =   540
  10.    LinkTopic       =   "Form1"
  11.    MDIChild        =   -1  'True
  12.    ScaleHeight     =   3975
  13.    ScaleWidth      =   5610
  14.    Top             =   1800
  15.    Visible         =   0   'False
  16.    Width           =   5730
  17.    Begin TextBox Text1 
  18.       Height          =   3855
  19.       HideSelection   =   0   'False
  20.       Left            =   0
  21.       MultiLine       =   -1  'True
  22.       ScrollBars      =   3  'Both
  23.       TabIndex        =   0
  24.       Top             =   0
  25.       Width           =   5655
  26.    End
  27.    Begin Menu mnuFile 
  28.       Caption         =   "&File"
  29.       Begin Menu mnuFNew 
  30.          Caption         =   "&New"
  31.       End
  32.       Begin Menu mnuFOpen 
  33.          Caption         =   "&Open..."
  34.       End
  35.       Begin Menu mnuFClose 
  36.          Caption         =   "&Close"
  37.       End
  38.       Begin Menu mnuFSave 
  39.          Caption         =   "&Save"
  40.       End
  41.       Begin Menu mnuFSaveAs 
  42.          Caption         =   "Save &As..."
  43.       End
  44.       Begin Menu mnuFSep 
  45.          Caption         =   "-"
  46.       End
  47.       Begin Menu Print 
  48.          Caption         =   "&Print"
  49.       End
  50.       Begin Menu seper 
  51.          Caption         =   "-"
  52.       End
  53.       Begin Menu mnuFExit 
  54.          Caption         =   "E&xit"
  55.       End
  56.       Begin Menu mnuRecentFile 
  57.          Caption         =   "-"
  58.          Index           =   0
  59.          Visible         =   0   'False
  60.       End
  61.       Begin Menu mnuRecentFile 
  62.          Caption         =   "RecentFile1"
  63.          Index           =   1
  64.          Visible         =   0   'False
  65.       End
  66.       Begin Menu mnuRecentFile 
  67.          Caption         =   "RecentFile2"
  68.          Index           =   2
  69.          Visible         =   0   'False
  70.       End
  71.       Begin Menu mnuRecentFile 
  72.          Caption         =   "RecentFile3"
  73.          Index           =   3
  74.          Visible         =   0   'False
  75.       End
  76.       Begin Menu mnuRecentFile 
  77.          Caption         =   "RecentFile4"
  78.          Index           =   4
  79.          Visible         =   0   'False
  80.       End
  81.    End
  82.    Begin Menu mnuEdit 
  83.       Caption         =   "&Edit"
  84.       Begin Menu mnuECut 
  85.          Caption         =   "Cu&t"
  86.          Shortcut        =   ^X
  87.       End
  88.       Begin Menu mnuECopy 
  89.          Caption         =   "&Copy"
  90.          Shortcut        =   ^C
  91.       End
  92.       Begin Menu mnuEPaste 
  93.          Caption         =   "&Paste"
  94.          Shortcut        =   ^V
  95.       End
  96.       Begin Menu mnuEDelete 
  97.          Caption         =   "De&lete"
  98.          Shortcut        =   {DEL}
  99.       End
  100.       Begin Menu mnuESep1 
  101.          Caption         =   "-"
  102.       End
  103.       Begin Menu mnuESelectAll 
  104.          Caption         =   "Select &All"
  105.       End
  106.       Begin Menu mnuETime 
  107.          Caption         =   "Time/&Date"
  108.       End
  109.    End
  110.    Begin Menu mnuSearch 
  111.       Caption         =   "&Search"
  112.       Begin Menu mnuSFind 
  113.          Caption         =   "&Find"
  114.       End
  115.       Begin Menu mnuSFindNext 
  116.          Caption         =   "Find &Next"
  117.          Shortcut        =   {F3}
  118.       End
  119.    End
  120.    Begin Menu mnuOptions 
  121.       Caption         =   "&Options"
  122.       Begin Menu mnuOToolbar 
  123.          Caption         =   "&Toolbar"
  124.       End
  125.    End
  126.    Begin Menu mnuWindow 
  127.       Caption         =   "&Window"
  128.       WindowList      =   -1  'True
  129.       Begin Menu mnuWCascade 
  130.          Caption         =   "&Cascade"
  131.       End
  132.       Begin Menu mnuWTile 
  133.          Caption         =   "&Tile"
  134.       End
  135.       Begin Menu mnuWArrange 
  136.          Caption         =   "&Arrange Icons"
  137.       End
  138.    End
  139.    Begin Menu VB 
  140.       Caption         =   "VB-Script"
  141.       Begin Menu REG 
  142.          Caption         =   "REGULAR COMMANDS"
  143.       End
  144.       Begin Menu c 
  145.          Caption         =   "-"
  146.       End
  147.       Begin Menu VBSCRIPT 
  148.          Caption         =   "<SCRIPT LANGUAGE=""VBSCRIPT"">"
  149.       End
  150.       Begin Menu COMENCE 
  151.          Caption         =   "<!--"
  152.       End
  153.       Begin Menu ENDSCRIPT 
  154.          Caption         =   "-->"
  155.       End
  156.       Begin Menu FINALINE 
  157.          Caption         =   "</SCRIPT>"
  158.       End
  159.       Begin Menu SUB 
  160.          Caption         =   "SUB"
  161.       End
  162.       Begin Menu ENDSUB 
  163.          Caption         =   "END SUB"
  164.       End
  165.       Begin Menu BLANK 
  166.          Caption         =   "-"
  167.       End
  168.       Begin Menu main 
  169.          Caption         =   "&MAIN FUNCTIONS"
  170.          Begin Menu function 
  171.             Caption         =   "Function"
  172.          End
  173.          Begin Menu ENDFUNCTION 
  174.             Caption         =   "End Function"
  175.          End
  176.          Begin Menu a 
  177.             Caption         =   "-"
  178.          End
  179.          Begin Menu InputMenu 
  180.             Caption         =   "Input menu"
  181.             Begin Menu INPUTTYPE 
  182.                Caption         =   "<INPUT TYPE=""BUTTON"" "
  183.             End
  184.             Begin Menu SUBMIT 
  185.                Caption         =   "<INPUT TYPE=""SUBMIT"">"
  186.             End
  187.             Begin Menu RESET 
  188.                Caption         =   "<INPUT TYPE=""RESET"">"
  189.             End
  190.          End
  191.          Begin Menu ifmenu 
  192.             Caption         =   "If Menu"
  193.             Begin Menu if 
  194.                Caption         =   "If Then"
  195.             End
  196.             Begin Menu else 
  197.                Caption         =   "Else"
  198.             End
  199.             Begin Menu endif 
  200.                Caption         =   "endif"
  201.             End
  202.          End
  203.          Begin Menu LOOPS 
  204.             Caption         =   "&LOOPS"
  205.             Begin Menu FOR 
  206.                Caption         =   "FOR NEXT LOOP"
  207.             End
  208.             Begin Menu dountil 
  209.                Caption         =   "Do-Until"
  210.             End
  211.             Begin Menu dotilloop 
  212.                Caption         =   "Do-Until Loop"
  213.             End
  214.             Begin Menu dowhile 
  215.                Caption         =   "Do-While"
  216.             End
  217.             Begin Menu dowhileloop 
  218.                Caption         =   "Do-While Loop"
  219.             End
  220.          End
  221.       End
  222.    End
  223.    Begin Menu Help 
  224.       Caption         =   "Help"
  225.       Begin Menu hfile 
  226.          Caption         =   "Help File"
  227.       End
  228.       Begin Menu techsupport 
  229.          Caption         =   "Obtaining Technical Support"
  230.       End
  231.       Begin Menu about 
  232.          Caption         =   "About DSG VB-Script Pad"
  233.       End
  234.    End
  235. Sub about_Click ()
  236. form2.Show
  237. End Sub
  238. Sub COMENCE_Click ()
  239. frmMDI.ActiveForm.ActiveControl.SelText = "<!--"
  240. frmMDI.ActiveForm.ActiveControl.SelText = ""
  241. End Sub
  242. Sub dotilloop_Click ()
  243. frmMDI.ActiveForm.ActiveControl.SelText = "Do Until             Loop"
  244. End Sub
  245. Sub dountil_Click ()
  246. frmMDI.ActiveForm.ActiveControl.SelText = "Do            Until"
  247. End Sub
  248. Sub dowhile_Click ()
  249. frmMDI.ActiveForm.ActiveControl.SelText = "Do              While"
  250. End Sub
  251. Sub dowhileloop_Click ()
  252. frmMDI.ActiveForm.ActiveControl.SelText = "Do While        Loop"
  253. End Sub
  254. Sub else_Click ()
  255. frmMDI.ActiveForm.ActiveControl.SelText = "else"
  256. End Sub
  257. Sub ENDFUNCTION_Click ()
  258. frmMDI.ActiveForm.ActiveControl.SelText = "End Function"
  259. End Sub
  260. Sub endif_Click ()
  261. frmMDI.ActiveForm.ActiveControl.SelText = "End If"
  262. End Sub
  263. Sub ENDSCRIPT_Click ()
  264. frmMDI.ActiveForm.ActiveControl.SelText = "-->"
  265. frmMDI.ActiveForm.ActiveControl.SelText = ""
  266. End Sub
  267. Sub ENDSUB_Click ()
  268. frmMDI.ActiveForm.ActiveControl.SelText = "End Sub"
  269. End Sub
  270. Sub FINALINE_Click ()
  271. frmMDI.ActiveForm.ActiveControl.SelText = "</SCRIPT>"
  272. End Sub
  273. Sub FOR_Click ()
  274. frmMDI.ActiveForm.ActiveControl.SelText = "For                    Next"
  275. End Sub
  276. Sub Form_QueryUnload (Cancel As Integer, UnloadMode As Integer)
  277.     Dim Msg, Filename, NL
  278.     Dim Response As Integer
  279.     If FState(Me.Tag).Dirty Then
  280.     Filename = Me.Caption
  281.     NL = Chr$(10) & Chr$(13)
  282.     Msg = "The text in [" & Filename & "] has changed."
  283.     Msg = Msg & NL
  284.     Msg = Msg & "Do you want to save the changes?"
  285.     Response = MsgBox(Msg, 51, frmMDI.Caption)
  286.     Select Case Response
  287.     ' User selects Yes
  288.     Case 6
  289.         'Get the filename to save the file
  290.         Filename = GetFileName()
  291.         'If the user did notspecify a file name,
  292.         'cancel the unload; otherwise, save it.
  293.         If Filename = "" Then
  294.         Cancel = True
  295.         Else
  296.         SaveFileAs (Filename)
  297.         End If
  298.     ' User selects No
  299.     ' Ok to unload
  300.     Case 7
  301.         Cancel = False
  302.     ' User selects Cancel
  303.     ' Cancel the unload
  304.     Case 2
  305.         Cancel = True
  306.     End Select
  307.     End If
  308. End Sub
  309. Sub Form_Resize ()
  310.     If windowstate <> 1 And ScaleHeight <> 0 Then
  311.     text1.Visible = False
  312.     text1.Height = ScaleHeight
  313.     text1.Width = ScaleWidth
  314.     text1.Visible = True
  315.     End If
  316. End Sub
  317. Sub Form_Unload (Cancel As Integer)
  318.     FState(Me.Tag).Deleted = True
  319. 'Hide toolbar edit buttons if no notepad windows
  320.     If Not AnyPadsLeft() Then
  321.     frmMDI!imgCutButton.Visible = False
  322.     frmMDI!imgCopyButton.Visible = False
  323.     frmMDI!imgPasteButton.Visible = False
  324.     End If
  325. End Sub
  326. Sub function_Click ()
  327. frmMDI.ActiveForm.ActiveControl.SelText = "Function"
  328. End Sub
  329. Sub hfile_Click ()
  330. form1.Show
  331. End Sub
  332. Sub if_Click ()
  333. frmMDI.ActiveForm.ActiveControl.SelText = "If        Then"
  334. End Sub
  335. Sub INPUTTYPE_Click ()
  336. frmMDI.ActiveForm.ActiveControl.SelText = "<INPUT TYPE=" + Chr(34) + "Button" + Chr(34) + " NAME=Button1" + " VALUE=" + Chr(34) + " Button1" + Chr(34) + ">"
  337. End Sub
  338. Sub mnuECopy_Click ()
  339.     EditCopyProc
  340. End Sub
  341. Sub mnuECut_Click ()
  342.     EditCutProc
  343. End Sub
  344. Sub mnuEDelete_Click ()
  345.   ' If cursor is not at the end of the notepad.
  346.   If screen.ActiveControl.SelStart <> Len(screen.ActiveControl.Text) Then
  347.     ' If nothing is selected, extend selection by one.
  348.     If screen.ActiveControl.SelLength = 0 Then
  349.       screen.ActiveControl.SelLength = 1
  350.       ' If cursor is on a blank line, extend selection by two.
  351.       If Asc(screen.ActiveControl.SelText) = 13 Then
  352.     screen.ActiveControl.SelLength = 2
  353.       End If
  354.     End If
  355.     ' Delete selected text.
  356.     screen.ActiveControl.SelText = ""
  357.   End If
  358. End Sub
  359. Sub mnuEPaste_Click ()
  360.     EditPasteProc
  361. End Sub
  362. Sub mnuESelectAll_Click ()
  363.     frmMDI.ActiveForm.text1.SelStart = 0
  364.     frmMDI.ActiveForm.text1.SelLength = Len(frmMDI.ActiveForm.text1.Text)
  365. End Sub
  366. Sub mnuETime_Click ()
  367.     Dim TimeStr As String, DateStr As String
  368.     text1.SelText = Now
  369. End Sub
  370. Sub mnuFClose_Click ()
  371.     Unload Me
  372. End Sub
  373. Sub mnuFExit_Click ()
  374.     ' Unloading the MDI form invokes the QueryUnload event
  375.     ' for each child form, then the MDI form - before unloading
  376.     ' the MDI form. Setting the Cancel argument to True in any of the
  377.     ' QueryUnload events aborts the unload.
  378.     Unload frmMDI
  379. End Sub
  380. Sub mnuFNew_Click ()
  381.     FileNew
  382. End Sub
  383. Sub mnuFontName_Click (index As Integer)
  384. End Sub
  385. Sub mnuFOpen_Click ()
  386.     FOpenProc
  387. End Sub
  388. Sub mnuFSave_Click ()
  389.     Dim Filename As String
  390.     If Left(Me.Caption, 8) = "Untitled" Then
  391.     ' The file hasn't been saved yet,
  392.     ' get the filename, then call the
  393.     ' save procedure
  394.     Filename = GetFileName()
  395.     Else
  396.     ' The caption contains the name of the open file
  397.     Filename = Me.Caption
  398.     End If
  399.     ' call the save procedure, if Filename = Empty then
  400.     ' the user selected Cancel in the Save As dialog, otherwise
  401.     ' save the file
  402.     If Filename <> "" Then
  403.     SaveFileAs Filename
  404.     End If
  405. End Sub
  406. Sub mnuFSaveAs_Click ()
  407.     Dim SaveFileName As String
  408.     SaveFileName = GetFileName()
  409.     If SaveFileName <> "" Then SaveFileAs (SaveFileName)
  410.     ' Update the recent files menu
  411.     UpdateFileMenu (SaveFileName)
  412. End Sub
  413. Sub mnuOptions_Click ()
  414.     mnuOToolbar.Checked = frmMDI!picToolbar.Visible
  415. End Sub
  416. Sub mnuOToolbar_Click ()
  417.     OptionsToolbarProc Me
  418. End Sub
  419. Sub mnuRecentFile_Click (index As Integer)
  420.   OpenFile (mnuRecentFile(index).Caption)
  421.   ' Update recent files list for new notepad.
  422.   GetRecentFiles
  423. End Sub
  424. Sub mnuSFind_Click ()
  425.     If Me!text1.SelText <> "" Then
  426.     frmFind!text1.Text = Me!text1.SelText
  427.     Else
  428.     frmFind!text1.Text = FindString
  429.     End If
  430.     gFirstTime = True
  431.     frmFind.Show
  432. End Sub
  433. Sub mnuSFindNext_Click ()
  434.     If Len(gFindString) > 0 Then
  435.     FindIt
  436.     Else
  437.     mnuSFind_Click
  438.     End If
  439. End Sub
  440. Sub mnuWArrange_Click ()
  441.     frmMDI.Arrange ARRANGE_ICONS
  442. End Sub
  443. Sub mnuWCascade_Click ()
  444.     frmMDI.Arrange CASCADE
  445. End Sub
  446. Sub mnuWTile_Click ()
  447.     frmMDI.Arrange TILE_HORIZONTAL
  448. End Sub
  449. Sub Print_Click ()
  450. printer.Print text1.Text
  451. printer.EndDoc
  452. End Sub
  453. Sub RESET_Click ()
  454. frmMDI.ActiveForm.ActiveControl.SelText = "<INPUT TYPE=" + Chr(34) + "Reset" + Chr(34) + ">"
  455. End Sub
  456. Sub SUB_Click ()
  457. frmMDI.ActiveForm.ActiveControl.SelText = "Sub  "
  458. End Sub
  459. Sub SUBMIT_Click ()
  460. frmMDI.ActiveForm.ActiveControl.SelText = "<INPUT TYPE=" + Chr(34) + "Submit" + Chr(34) + ">"
  461. End Sub
  462. Sub techsupport_Click ()
  463. MsgBox "FOR TECHNICAL SUPPORT E-MAIL DSG@HOTBOT.COM"
  464. End Sub
  465. Sub Text1_Change ()
  466.     FState(Me.Tag).Dirty = True
  467. End Sub
  468. Sub Text1_GotFocus ()
  469.     If frmFind.Visible Then
  470.     frmFind.ZOrder 0
  471.     End If
  472. End Sub
  473. Sub VBSCRIPT_Click ()
  474. frmMDI.ActiveForm.ActiveControl.SelText = " <SCRIPT LANGUAGE=" + Chr(34) + "VBSCRIPT" + Chr(34) + "> "
  475. frmMDI.ActiveForm.ActiveControl.SelText = ""
  476. End Sub
  477.